using Abp.Domain.Repositories;
using HCD.Hcd.Dtos;
using HCD.Entities;
using System.Linq;
using Abp.Application.Services;
using Abp.Application.Services.Dto;
using Abp.Linq.Extensions;
using HCD.Const;

namespace HCD.Hcd
{
    /// <summary>
    /// 应用层服务的接口实现方法
    ///</summary>
    public class PatientPartingInfoAppService : AsyncCrudAppService<PatientPartingInfo, PatientPartingInfoDto, long, PatientPartingInfoGetAllInput, PatientPartingInfoEditDto, PatientPartingInfoEditDto, EntityDto<long>, EntityDto<long>>, IPatientPartingInfoAppService
    {
        public PatientPartingInfoAppService(IRepository<PatientPartingInfo, long> repository)
        : base(repository)
        {
            LocalizationSourceName = EnterpriseConsts.LocalizationSourceName;
        }

        protected override IQueryable<PatientPartingInfo> CreateFilteredQuery(PatientPartingInfoGetAllInput input)
        {
            return base.CreateFilteredQuery(input)
                .WhereIf(!string.IsNullOrWhiteSpace(input.PatientId), t => t.PatientId == input.PatientId)
                .WhereIf(!string.IsNullOrWhiteSpace(input.VisitId), t => t.VisitId == input.VisitId);
        }
    }
}


